package com.zxy.dao;

import com.zxy.entity.Role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zxy
 * @since 2022-03-11
 */
public interface RoleMapper extends BaseMapper<Role> {

    @Select("SELECT permission FROM t_permission p LEFT JOIN t_role_permission rp on p.id=rp.permission_id LEFT JOIN t_user_role ur on rp.role_id=ur.role_id where ur.user_id=#{userId}")
    List<String> selectPermissionByUserId(Integer userId);
}
